package edu.ucsd.db.bassarisk.algebra.logical;

import java.util.ArrayList;
import java.util.Collection;

import edu.ucsd.db.bassarisk.algebra.logical.visitor.LogicalOperatorVisitor;
import edu.ucsd.db.bassarisk.query.predicate.PositionPredicates.PositionPredicate;

public class Select extends LogicalOperator {
  private final Collection<PositionPredicate> predicates;
  private final LogicalOperator subPlan;
  
  public Select(Collection<PositionPredicate> predicates, LogicalOperator subPlan) {
    this.predicates = new ArrayList<PositionPredicate>();
    this.predicates.addAll(predicates);
    this.subPlan = subPlan;
  }
  
  public Iterable<PositionPredicate> predicates() {
    return predicates;
  }
  
  public LogicalOperator subPlan() {
    return subPlan;
  }

  @Override
  public <R, A> R accept(LogicalOperatorVisitor<R, A> visitor, A arg) {
    return visitor.visitSelect(this, arg);
  }
}
